<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"
 lang="en" dir="ltr">
<head>


<!-- Start Wayback Rewrite JS Include -->
<script type="text/javascript" src="/static/js/jwplayer/jwplayer.js" ></script>
<script type="text/javascript" src="/static/js/video-embed-rewriter.js"></script>
<script type="text/javascript">
function initYTVideo(id)
{
	_wmVideos_.init("/web/", id);
}
</script>
<!-- End Wayback Rewrite JS Include -->

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="verify-v1" content="tEylf9LB80tZDZII2uUNxN3+9HapRA1UHg7SJueJFAU=" />
  <meta name="microid" content="74bfdb1c0b1e19f7f7ccce246e7a0c9f884072ce" />
  <title>
    specs:1.2 · LOLCODE  </title>
  <link rel="stylesheet" type="text/css" href="/web/20120908173209cs_/http://cache.blogads.com/176020183/feed.css" />
  <link rel="alternate" type="application/rss+xml" title="Site News (Blog)" href="/web/20120908173209/http://feeds.lolcode.com/lolcode">
  <meta name="generator" content="DokuWiki Release 2008-05-05" />
<meta name="robots" content="index,follow" />
<meta name="date" content="2007-07-24T00:21:20+0000" />
<meta name="keywords" content="specs,1.2" />
<link rel="search" type="application/opensearchdescription+xml" href="/web/20120908173209/http://lolcode.com/lib/exe/opensearch.php" title="LOLCODE" />
<link rel="start" href="/web/20120908173209/http://lolcode.com/" />
<link rel="contents" href="/web/20120908173209/http://lolcode.com/specs/1.2?do=index" title="Index" />
<link rel="alternate" type="application/rss+xml" title="Recent Changes" href="/web/20120908173209/http://lolcode.com/feed.php" />
<link rel="alternate" type="application/rss+xml" title="Current Namespace" href="/web/20120908173209/http://lolcode.com/feed.php?mode=list&ns=specs" />
<link rel="alternate" type="text/html" title="Plain HTML" href="/web/20120908173209/http://lolcode.com/_export/xhtml/specs/1.2" />
<link rel="alternate" type="text/plain" title="Wiki Markup" href="/web/20120908173209/http://lolcode.com/_export/raw/specs/1.2" />
<link rel="stylesheet" media="all" type="text/css" href="/web/20120908173209cs_/http://lolcode.com/lib/exe/css.php?s=all&t=minima" />
<link rel="stylesheet" media="screen" type="text/css" href="/web/20120908173209cs_/http://lolcode.com/lib/exe/css.php?t=minima" />
<link rel="stylesheet" media="print" type="text/css" href="/web/20120908173209cs_/http://lolcode.com/lib/exe/css.php?s=print&t=minima" />
<script type="text/javascript" charset="utf-8" src="/web/20120908173209js_/http://lolcode.com/lib/exe/js.php?edit=0&write=0" ></script>
<script type="text/javascript" charset="utf-8" src="/web/20120908173209js_/http://lolcode.com/lib/plugins/indexmenu/jsmenu/menu.js" ></script>
<script type="text/javascript" charset="utf-8" src="/web/20120908173209js_/http://lolcode.com/lib/plugins/indexmenu/indexmenu.js" ></script>
<script type="text/javascript" charset="utf-8" ><!--//--><![CDATA[//><!--
var indexmenu_ID='specs/1.2'
//--><!]]></script>
<script type="text/javascript" charset="utf-8" ><!--//--><![CDATA[//><!--
addInitEvent(function(){
	for ( i=0; i < document.forms.length; i++ ) {
		if (document.forms[i].method == 'post') {
			var myElement = document.createElement('input');
			myElement.setAttribute('type', 'hidden');
			myElement.name = 'bb2_screener_';
			myElement.value = '1347125529 204.236.226.210';
			document.forms[i].appendChild(myElement);
		}
	}
});
//--><!]]></script>
<script type="text/javascript">
  if (top !== self && document.referrer.match(/digg\.com\/\w{1,8}/)) {
    top.location.replace(self.location.href);
  }
</script>
  <link rel="shortcut icon" href="/web/20120908173209im_/http://lolcode.com/lib/tpl/minima/images/favicon.ico" />

  </head>

<body>
<!-- BEGIN WAYBACK TOOLBAR INSERT -->

<script type="text/javascript" src="/static/js/disclaim-element.js" ></script>
<script type="text/javascript" src="/static/js/graph-calc.js" ></script>
<script type="text/javascript" src="/static/jflot/jquery.min.js" ></script>
<script type="text/javascript">
//<![CDATA[
var firstDate = 820454400000;
var lastDate = 1388534399999;
var wbPrefix = "/web/";
var wbCurrentUrl = "http:\/\/lolcode.com\/specs\/1.2";

var curYear = -1;
var curMonth = -1;
var yearCount = 18;
var firstYear = 1996;
var imgWidth = 450;
var yearImgWidth = 25;
var monthImgWidth = 2;
var trackerVal = "none";
var displayDay = "8";
var displayMonth = "сен";
var displayYear = "2012";
var prettyMonths = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];

function showTrackers(val) {
	if(val == trackerVal) {
		return;
	}
	if(val == "inline") {
		document.getElementById("displayYearEl").style.color = "#ec008c";
		document.getElementById("displayMonthEl").style.color = "#ec008c";
		document.getElementById("displayDayEl").style.color = "#ec008c";		
	} else {
		document.getElementById("displayYearEl").innerHTML = displayYear;
		document.getElementById("displayYearEl").style.color = "#ff0";
		document.getElementById("displayMonthEl").innerHTML = displayMonth;
		document.getElementById("displayMonthEl").style.color = "#ff0";
		document.getElementById("displayDayEl").innerHTML = displayDay;
		document.getElementById("displayDayEl").style.color = "#ff0";
	}
   document.getElementById("wbMouseTrackYearImg").style.display = val;
   document.getElementById("wbMouseTrackMonthImg").style.display = val;
   trackerVal = val;
}
function getElementX2(obj) {
	var thing = jQuery(obj);
	if((thing == undefined) 
			|| (typeof thing == "undefined") 
			|| (typeof thing.offset == "undefined")) {
		return getElementX(obj);
	}
	return Math.round(thing.offset().left);
}
function trackMouseMove(event,element) {

   var eventX = getEventX(event);
   var elementX = getElementX2(element);
   var xOff = eventX - elementX;
	if(xOff < 0) {
		xOff = 0;
	} else if(xOff > imgWidth) {
		xOff = imgWidth;
	}
   var monthOff = xOff % yearImgWidth;

   var year = Math.floor(xOff / yearImgWidth);
	var yearStart = year * yearImgWidth;
   var monthOfYear = Math.floor(monthOff / monthImgWidth);
   if(monthOfYear > 11) {
       monthOfYear = 11;
   }
   // 1 extra border pixel at the left edge of the year:
   var month = (year * 12) + monthOfYear;
   var day = 1;
	if(monthOff % 2 == 1) {
		day = 15;
	}
	var dateString = 
		zeroPad(year + firstYear) + 
		zeroPad(monthOfYear+1,2) +
		zeroPad(day,2) + "000000";

	var monthString = prettyMonths[monthOfYear];
	document.getElementById("displayYearEl").innerHTML = year + 1996;
	document.getElementById("displayMonthEl").innerHTML = monthString;
	// looks too jarring when it changes..
	//document.getElementById("displayDayEl").innerHTML = zeroPad(day,2);

	var url = wbPrefix + dateString + '/' +  wbCurrentUrl;
	document.getElementById('wm-graph-anchor').href = url;

   //document.getElementById("wmtbURL").value="evX("+eventX+") elX("+elementX+") xO("+xOff+") y("+year+") m("+month+") monthOff("+monthOff+") DS("+dateString+") Moy("+monthOfYear+") ms("+monthString+")";
   if(curYear != year) {
       var yrOff = year * yearImgWidth;
       document.getElementById("wbMouseTrackYearImg").style.left = yrOff + "px";
       curYear = year;
   }
   if(curMonth != month) {
       var mtOff = year + (month * monthImgWidth) + 1;
       document.getElementById("wbMouseTrackMonthImg").style.left = mtOff + "px";
       curMonth = month;
   }
}
//]]>
</script>

<style type="text/css">body{margin-top:0!important;padding-top:0!important;min-width:800px!important;}#wm-ipp a:hover{text-decoration:underline!important;}</style>
<div id="wm-ipp" style="display:none; position:relative;padding:0 5px;min-height:70px;min-width:800px; z-index:9000;">
<div id="wm-ipp-inside" style="position:fixed;padding:0!important;margin:0!important;width:97%;min-width:780px;border:5px solid #000;border-top:none;background-image:url(/static/images/toolbar/wm_tb_bk_trns.png);text-align:center;-moz-box-shadow:1px 1px 3px #333;-webkit-box-shadow:1px 1px 3px #333;box-shadow:1px 1px 3px #333;font-size:11px!important;font-family:'Lucida Grande','Arial',sans-serif!important;">
   <table style="border-collapse:collapse;margin:0;padding:0;width:100%;"><tbody><tr>
   <td style="padding:10px;vertical-align:top;min-width:110px;">
   <a href="/web/" title="Wayback Machine home page" style="background-color:transparent;border:none;"><img src="/static/images/toolbar/wayback-toolbar-logo.png" alt="Wayback Machine" width="110" height="39" border="0"/></a>
   </td>
   <td style="padding:0!important;text-align:center;vertical-align:top;width:100%;">

       <table style="border-collapse:collapse;margin:0 auto;padding:0;width:570px;"><tbody><tr>
       <td style="padding:3px 0;" colspan="2">
       <form target="_top" method="get" action="/web/form-submit.jsp" name="wmtb" id="wmtb" style="margin:0!important;padding:0!important;"><input type="text" name="url" id="wmtbURL" value="http://lolcode.com/specs/1.2" style="width:400px;font-size:11px;font-family:'Lucida Grande','Arial',sans-serif;" onfocus="javascript:this.focus();this.select();" /><input type="hidden" name="type" value="replay" /><input type="hidden" name="date" value="20120908173209" /><input type="submit" value="Go" style="font-size:11px;font-family:'Lucida Grande','Arial',sans-serif;margin-left:5px;" /><span id="wm_tb_options" style="display:block;"></span></form>
       </td>
       <td style="vertical-align:bottom;padding:5px 0 0 0!important;" rowspan="2">
           <table style="border-collapse:collapse;width:110px;color:#99a;font-family:'Helvetica','Lucida Grande','Arial',sans-serif;"><tbody>
			
           <!-- NEXT/PREV MONTH NAV AND MONTH INDICATOR -->
           <tr style="width:110px;height:16px;font-size:10px!important;">
           	<td style="padding-right:9px;font-size:11px!important;font-weight:bold;text-transform:uppercase;text-align:right;white-space:nowrap;overflow:visible;" nowrap="nowrap">
               
		                <a href="/web/20120608070059/http://lolcode.com/specs/1.2" style="text-decoration:none;color:#33f;font-weight:bold;background-color:transparent;border:none;" title="8 июн 2012"><strong>ИЮН</strong></a>
		                
               </td>
               <td id="displayMonthEl" style="background:#000;color:#ff0;font-size:11px!important;font-weight:bold;text-transform:uppercase;width:34px;height:15px;padding-top:1px;text-align:center;" title="You are here: 17:32:09 сен 8, 2012">СЕН</td>
				<td style="padding-left:9px;font-size:11px!important;font-weight:bold;text-transform:uppercase;white-space:nowrap;overflow:visible;" nowrap="nowrap">
               
                       окт
                       
               </td>
           </tr>

           <!-- NEXT/PREV CAPTURE NAV AND DAY OF MONTH INDICATOR -->
           <tr>
               <td style="padding-right:9px;white-space:nowrap;overflow:visible;text-align:right!important;vertical-align:middle!important;" nowrap="nowrap">
               
		                <a href="/web/20120608070059/http://lolcode.com/specs/1.2" title="7:00:59 июн 8, 2012" style="background-color:transparent;border:none;"><img src="/static/images/toolbar/wm_tb_prv_on.png" alt="Previous capture" width="14" height="16" border="0" /></a>
		                
               </td>
               <td id="displayDayEl" style="background:#000;color:#ff0;width:34px;height:24px;padding:2px 0 0 0;text-align:center;font-size:24px;font-weight: bold;" title="You are here: 17:32:09 сен 8, 2012">8</td>
				<td style="padding-left:9px;white-space:nowrap;overflow:visible;text-align:left!important;vertical-align:middle!important;" nowrap="nowrap">
               
                       <img src="/static/images/toolbar/wm_tb_nxt_off.png" alt="Next capture" width="14" height="16" border="0"/>
                       
			    </td>
           </tr>

           <!-- NEXT/PREV YEAR NAV AND YEAR INDICATOR -->
           <tr style="width:110px;height:13px;font-size:9px!important;">
				<td style="padding-right:9px;font-size:11px!important;font-weight: bold;text-align:right;white-space:nowrap;overflow:visible;" nowrap="nowrap">
               
		                <a href="/web/20110906022012/http://lolcode.com/specs/1.2" style="text-decoration:none;color:#33f;font-weight:bold;background-color:transparent;border:none;" title="6 сен 2011"><strong>2011</strong></a>
		                
               </td>
               <td id="displayYearEl" style="background:#000;color:#ff0;font-size:11px!important;font-weight: bold;padding-top:1px;width:34px;height:13px;text-align:center;" title="You are here: 17:32:09 сен 8, 2012">2012</td>
				<td style="padding-left:9px;font-size:11px!important;font-weight: bold;white-space:nowrap;overflow:visible;" nowrap="nowrap">
               
                       2013
                       
				</td>
           </tr>
           </tbody></table>
       </td>

       </tr>
       <tr>
       <td style="vertical-align:middle;padding:0!important;">
           <a href="/web/20120908173209*/http://lolcode.com/specs/1.2" style="color:#33f;font-size:11px;font-weight:bold;background-color:transparent;border:none;" title="See a list of every capture for this URL"><strong>49 captures</strong></a>
           <div style="margin:0!important;padding:0!important;color:#666;font-size:9px;padding-top:2px!important;white-space:nowrap;" title="Timespan for captures of this URL">28 май 07 - 8 сен 12</div>
       </td>
       <td style="padding:0!important;">
       <a style="position:relative; white-space:nowrap; width:450px;height:27px;" href="" id="wm-graph-anchor">
       <div id="wm-ipp-sparkline" style="position:relative; white-space:nowrap; width:450px;height:27px;background-color:#fff;cursor:pointer;border-right:1px solid #ccc;" title="Explore captures for this URL">
			<img id="sparklineImgId" style="position:absolute; z-index:9012; top:0px; left:0px;"
				onmouseover="showTrackers('inline');" 
				onmouseout="showTrackers('none');"
				onmousemove="trackMouseMove(event,this)"
				alt="sparklines"
				width="450"
				height="27"
				border="0"
				src="/web/jsp/graph.jsp?graphdata=450_27_1996:-1:000000000000_1997:-1:000000000000_1998:-1:000000000000_1999:-1:000000000000_2000:-1:000000000000_2001:-1:000000000000_2002:-1:000000000000_2003:-1:000000000000_2004:-1:000000000000_2005:-1:000000000000_2006:-1:000000000000_2007:-1:000010323200_2008:-1:220110000001_2009:-1:120000110101_2010:-1:111000011000_2011:-1:000001212311_2012:8:410002001000_2013:-1:000000000000"></img>
			<img id="wbMouseTrackYearImg" 
				style="display:none; position:absolute; z-index:9010;"
				width="25" 
				height="27"
				border="0"
				src="/static/images/toolbar/transp-yellow-pixel.png"></img>
			<img id="wbMouseTrackMonthImg"
				style="display:none; position:absolute; z-index:9011; " 
				width="2"
				height="27" 
				border="0"
				src="/static/images/toolbar/transp-red-pixel.png"></img>
       </div>
		</a>

       </td>
       </tr></tbody></table>
   </td>
   <td style="text-align:right;padding:5px;width:65px;font-size:11px!important;">
       <a href="javascript:;" onclick="document.getElementById('wm-ipp').style.display='none';" style="display:block;padding-right:18px;background:url(/static/images/toolbar/wm_tb_close.png) no-repeat 100% 0;color:#33f;font-family:'Lucida Grande','Arial',sans-serif;margin-bottom:23px;background-color:transparent;border:none;" title="Close the toolbar">Close</a>
       <a href="http://faq.web.archive.org/" style="display:block;padding-right:18px;background:url(/static/images/toolbar/wm_tb_help.png) no-repeat 100% 0;color:#33f;font-family:'Lucida Grande','Arial',sans-serif;background-color:transparent;border:none;" title="Get some help using the Wayback Machine">Help</a>
   </td>
   </tr></tbody></table>

</div>
</div>
<script type="text/javascript">
 var wmDisclaimBanner = document.getElementById("wm-ipp");
 if(wmDisclaimBanner != null) {
   disclaimElement(wmDisclaimBanner);
 }
</script>
<!-- END WAYBACK TOOLBAR INSERT -->

<div class="dokuwiki" id="minima__medium_left">
  
  <div class="header">
    <div class="logo">
      <a href="/web/20120908173209/http://lolcode.com/"  name="dokuwiki__top" id="dokuwiki__top" accesskey="h" title="[ALT+H]">LOLCODE</a>    </div>
  </div>

  
  <div class="main">
  
        <div class="breadcrumbs">
      <span class="bchead">Trace:</span> <span class="bcsep">&raquo;</span> <a href="/web/20120908173209/http://lolcode.com/examples/filezorz"  class="breadcrumbs" title="examples:filezorz">filezorz</a> <span class="bcsep">&raquo;</span> <a href="/web/20120908173209/http://lolcode.com/examples/gimmeh"  class="breadcrumbs" title="examples:gimmeh">gimmeh</a> <span class="bcsep">&raquo;</span> <a href="/web/20120908173209/http://lolcode.com/keywords/can-has"  class="breadcrumbs" title="keywords:can-has">can-has</a> <span class="bcsep">&raquo;</span> <a href="/web/20120908173209/http://lolcode.com/contributions/o-rly"  class="breadcrumbs" title="contributions:o-rly">o-rly</a> <span class="bcsep">&raquo;</span> <span class="curid"><a href="/web/20120908173209/http://lolcode.com/specs/1.2"  class="breadcrumbs" title="specs:1.2">1.2</a></span>    </div>
      
        
    
        
      
    <div class="page">
        
      <!-- wikipage start -->
      <!-- TOC START -->
<div class="toc">
<div class="tocheader toctoggle" id="toc__header">Table of Contents</div>
<div id="toc__inside">

<ul class="toc">
<li class="level1"><div class="li"><span class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2#final-draft" class="toc">FINAL DRAFT</a></span></div>
<ul class="toc">
<li class="level2"><div class="li"><span class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2#july-2007" class="toc">12 July 2007</a></span></div></li>
</ul>
</li>
<li class="level1"><div class="li"><span class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2#formatting" class="toc">Formatting</a></span></div>
<ul class="toc">
<li class="level2"><div class="li"><span class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2#whitespace" class="toc">whitespace</a></span></div></li>
<li class="level2"><div class="li"><span class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2#comments" class="toc">comments</a></span></div></li>
<li class="level2"><div class="li"><span class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2#file-creation" class="toc">file creation</a></span></div></li>
</ul>
</li>
<li class="level1"><div class="li"><span class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2#variables" class="toc">Variables</a></span></div>
<ul class="toc">
<li class="level2"><div class="li"><span class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2#scope" class="toc">scope</a></span></div></li>
<li class="level2"><div class="li"><span class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2#naming" class="toc">naming</a></span></div></li>
<li class="level2"><div class="li"><span class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2#declaration-and-assignment" class="toc">declaration and assignment</a></span></div></li>
</ul>
</li>
<li class="level1"><div class="li"><span class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2#types" class="toc">Types</a></span></div>
<ul class="toc">
<li class="level2"><div class="li"><span class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2#untyped" class="toc">untyped</a></span></div></li>
<li class="level2"><div class="li"><span class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2#booleans" class="toc">booleans</a></span></div></li>
<li class="level2"><div class="li"><span class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2#numerical-types" class="toc">numerical types</a></span></div></li>
<li class="level2"><div class="li"><span class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2#strings" class="toc">strings</a></span></div></li>
<li class="level2"><div class="li"><span class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2#arrays" class="toc">arrays</a></span></div></li>
<li class="level2"><div class="li"><span class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2#types1" class="toc">types</a></span></div></li>
</ul>
</li>
<li class="level1"><div class="li"><span class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2#operators" class="toc">Operators</a></span></div>
<ul class="toc">
<li class="level2"><div class="li"><span class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2#calling-syntax-and-precedence" class="toc">calling syntax and precedence</a></span></div></li>
<li class="level2"><div class="li"><span class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2#math" class="toc">math</a></span></div></li>
<li class="level2"><div class="li"><span class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2#boolean" class="toc">boolean</a></span></div></li>
<li class="level2"><div class="li"><span class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2#comparison" class="toc">comparison</a></span></div></li>
<li class="level2"><div class="li"><span class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2#concatenation" class="toc">concatenation</a></span></div></li>
<li class="level2"><div class="li"><span class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2#casting" class="toc">casting</a></span></div></li>
</ul>
</li>
<li class="level1"><div class="li"><span class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2#inputouput" class="toc">Input/Ouput</a></span></div>
<ul class="toc">
<li class="level2"><div class="li"><span class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2#terminal-based" class="toc">terminal-based</a></span></div></li>
</ul>
</li>
<li class="level1"><div class="li"><span class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2#statements" class="toc">Statements</a></span></div>
<ul class="toc">
<li class="level2"><div class="li"><span class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2#expression-statements" class="toc">expression statements</a></span></div></li>
<li class="level2"><div class="li"><span class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2#assignment-statements" class="toc">assignment statements</a></span></div></li>
<li class="level2"><div class="li"><span class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2#flow-control-statements" class="toc">flow control statements</a></span></div></li>
</ul>
</li>
<li class="level1"><div class="li"><span class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2#flow-control" class="toc">Flow control</a></span></div>
<ul class="toc">
<li class="level2"><div class="li"><span class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2#conditionals" class="toc">conditionals</a></span></div></li>
<li class="level2"><div class="li"><span class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2#loops" class="toc">loops</a></span></div></li>
</ul>
</li>
<li class="level1"><div class="li"><span class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2#functions" class="toc">Functions</a></span></div>
<ul class="toc">
<li class="level2"><div class="li"><span class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2#definition" class="toc">definition</a></span></div></li>
<li class="level2"><div class="li"><span class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2#returning" class="toc">returning</a></span></div></li>
<li class="level2"><div class="li"><span class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2#calling" class="toc">calling</a></span></div></li></ul>
</li></ul>
</div>
</div>
<!-- TOC END -->



<h1><a name="lolcode-specification-1.2" id="lolcode-specification-1.2">LOLCODE Specification 1.2</a></h1>
<div class="level1">

</div>

<h2><a name="final-draft" id="final-draft">FINAL DRAFT</a></h2>
<div class="level2">

</div>

<h3><a name="july-2007" id="july-2007">12 July 2007</a></h3>
<div class="level3">

<p>
<em>The goal of this specification is to act as a baseline for all following LOLCODE specifications. As such, some traditionally expected language features may appear “incomplete.” This is most likely deliberate, as it will be easier to add to the language than to change and introduce further incompatibilities.</em>
</p>

</div>

<h2><a name="formatting" id="formatting">Formatting</a></h2>
<div class="level2">

</div>

<h3><a name="whitespace" id="whitespace">whitespace</a></h3>
<div class="level3">
<ol>
<li class="level1"><div class="li"> Spaces are used to demarcate tokens in the language, although some keyword constructs may include spaces.</div>
</li>
<li class="level1"><div class="li"> Multiple spaces and tabs are treated as single spaces and are otherwise irrelevant.</div>
</li>
<li class="level1"><div class="li"> Indentation is irrelevant.</div>
</li>
<li class="level1"><div class="li"> A command starts at the beginning of a line and a newline indicates the end of a command, except in special cases.</div>
</li>
<li class="level1"><div class="li"> A newline will be Carriage Return (/13), a Line Feed (/10) or both (/13/10) depending on the implementing system.  This is only in regards to LOLCODE code itself, and does not indicate how these should be treated in strings or files during execution.</div>
</li>
<li class="level1"><div class="li"> Multiple commands can be put on a single line if they are separated by a comma (,).  In this case, the comma acts as a virtual newline or a soft-command-break.</div>
</li>
<li class="level1"><div class="li"> Multiple lines can be combined into a single command by including three periods (…) or the unicode ellipsis character (u2026) at the end of the line.  This causes the contents of the next line to be evaluated as if it were on the same line.</div>
</li>
<li class="level1"><div class="li"> Lines with line continuation can be strung together, many in a row, to allow a single command to stretch over more than one or two lines.  As long as each line is ended with three periods, the next line is included, until a line without three periods is reached, at which point, the entire command may be processed.</div>
</li>
<li class="level1"><div class="li"> A line with line continuation may not be followed by an empty line.</div>
</li>
<li class="level1"><div class="li"> Three periods may be by themselves on a single line, in which case, the empty line is “included” in the command (doing nothing), and the next line is included as well.</div>
</li>
<li class="level1"><div class="li"> A single-line comment is always terminated by a newline.  Line continuation (…) and soft-command-breaks (,) after the comment (<acronym title="By the way">BTW</acronym>) are ignored.</div>
</li>
<li class="level1"><div class="li"> Line continuation &amp; soft-command-breaks are ignored inside quoted strings.  An unterminated string literal (no closing quote) will cause an error.</div>
</li>
</ol>

</div>

<h3><a name="comments" id="comments">comments</a></h3>
<div class="level3">

<p>
<em>from <a href="/web/20120908173209/http://lolcode.com/specs/1.1" class="wikilink1" title="specs:1.1">1.1</a></em>
</p>

<p>
Single line comments are begun by <code><acronym title="By the way">BTW</acronym></code>, and may occur either after a line of code, on a 
separate line, or following a line of code following a line separator (,).
</p>

<p>
All of these are valid single line comments:

</p>
<pre class="code">I HAS A VAR ITZ 12        BTW VAR = 12</pre>
<pre class="code">I HAS A VAR ITZ 12,       BTW VAR = 12</pre>
<pre class="code">I HAS A VAR ITZ 12
                BTW VAR = 12</pre>

<p>
Multi-line comments are begun by <code>OBTW</code> and ended with <code>TLDR</code>, and should be started on their 
own line, or following a line of code after a line separator.
</p>

<p>
These are valid multi-line comments:

</p>
<pre class="code">I HAS A VAR ITZ 12
           OBTW this is a long comment block
                see, i have more comments here
                and here
           TLDR
I HAS A FISH ITZ BOB</pre>
<pre class="code">I HAS A VAR ITZ 12,  OBTW this is a long comment block
      see, i have more comments here
      and here
TLDR, I HAS A FISH ITZ BOB</pre>

</div>

<h3><a name="file-creation" id="file-creation">file creation</a></h3>
<div class="level3">

<p>
<em>modified from <a href="/web/20120908173209/http://lolcode.com/specs/1.1" class="wikilink1" title="specs:1.1">1.1</a></em>
</p>

<p>
All LOLCODE programs must be opened with the command <code>HAI</code>. <code>HAI</code> should then be followed with the current LOLCODE language version number (1.2, in this case). There is no current standard behavior for implementations to treat the version number, though.
</p>

<p>
A LOLCODE file is closed by the keyword <code>KTHXBYE</code> which closes the <code>HAI</code> code-block.
</p>

</div>

<h2><a name="variables" id="variables">Variables</a></h2>
<div class="level2">

</div>

<h3><a name="scope" id="scope">scope</a></h3>
<div class="level3">

<p>
<em>to be revisited and refined</em>
</p>

<p>
All variable scope, as of this version, is local to the enclosing function or to the main program block.
Variables are only accessible after declaration, and there is no global scope. 
</p>

</div>

<h3><a name="naming" id="naming">naming</a></h3>
<div class="level3">

<p>
<em>from <a href="/web/20120908173209/http://lolcode.com/specs/1.1" class="wikilink1" title="specs:1.1">1.1</a></em>
</p>

<p>
Variable identifiers may be in all CAPITAL or lowercase letters (or a mixture of the two). They must begin with a letter and may be followed only by other letters, numbers, and underscores. No spaces, dashes, or other symbols are allowed.  Variable identifiers are CASE SENSITIVE - “cheezburger”, “CheezBurger” and “CHEEZBURGER” would all be different variables.
</p>

</div>

<h3><a name="declaration-and-assignment" id="declaration-and-assignment">declaration and assignment</a></h3>
<div class="level3">

<p>
<em>modified from <a href="/web/20120908173209/http://lolcode.com/specs/1.1" class="wikilink1" title="specs:1.1">1.1</a></em>
</p>

<p>
To declare a variable, the keyword is <code>I HAS A</code> followed by the variable name. To assign the variable 
a value within the same statement, you can then follow the variable name with <code>ITZ &lt;value&gt;</code>. 
</p>

<p>
Assignment of a variable is accomplished with an assignment statement, <code>&lt;variable&gt; R &lt;expression&gt;</code>
</p>
<pre class="code">
I HAS A VAR          BTW VAR is null and untyped
VAR R &quot;THREE&quot;        BTW VAR is now a YARN and equals &quot;THREE&quot;
VAR R 3              BTW VAR is now a NUMBR and equals 3</pre>

<p>
Type conversion is handled automatically.
</p>

</div>

<h2><a name="types" id="types">Types</a></h2>
<div class="level2">

<p>
<em>updated from <a href="/web/20120908173209/http://lolcode.com/specs/1.1" class="wikilink1" title="specs:1.1">1.1</a></em>
</p>

<p>
The variable types that LOLCODE currently recognizes are: strings (YARN), integers 
(NUMBR), floats (NUMBAR), and booleans (TROOF) (Arrays (BUKKIT) are reserved for future expansion.) Typing is handled dynamically. Until a variable is given an initial value, it is untyped (NOOB). <del>Casting operations operate on TYPE types, as well.</del>
</p>

</div>

<h3><a name="untyped" id="untyped">untyped</a></h3>
<div class="level3">

<p>

The untyped type (NOOB) cannot be implicitly cast into any type except a TROOF. A cast into TROOF makes the variable FAIL. Any operations on a NOOB that assume another type (e.g., math) results in an error.
</p>

<p>
Explicit casts of a NOOB (untyped, uninitialized) variable are to empty/zero values for all other types.
</p>

</div>

<h3><a name="booleans" id="booleans">booleans</a></h3>
<div class="level3">

<p>
The two boolean (TROOF) values are WIN (true) and FAIL (false). The empty string (””), an empty array, and numerical zero are all cast to FAIL. All other values evaluate to WIN.
</p>

</div>

<h3><a name="numerical-types" id="numerical-types">numerical types</a></h3>
<div class="level3">

<p>
A NUMBR is an integer as specified in the host implementation/architecture. Any contiguous sequence of digits outside of a quoted YARN and not containing a decimal point (<strong>.</strong>) is considered a NUMBR. A NUMBR may have a leading hyphen (<strong>-</strong>) to signify a negative number.
</p>

<p>
A NUMBAR is a float as specified in the host implementation/architecture. It is represented as a contiguous string of digits containing exactly one decimal point. Casting a NUMBAR to a NUMBR truncates the decimal portion of the floating point number. Casting a NUMBAR to a YARN (by printing it, for example), truncates the output to a default of two decimal places. A NUMBR may have a leading hyphen (<strong>-</strong>) to signify a negative number.
</p>

<p>
Casting of a string to a numerical type parses the string as if it were not in quotes. If there are any non-numerical, non-hyphen, non-period characters, then it results in an error. Casting WIN to a numerical type results in “1” or “1.0”; casting FAIL results in a numerical zero.
</p>

</div>

<h3><a name="strings" id="strings">strings</a></h3>
<div class="level3">

<p>
String literals (YARN) are demarked with double quotation marks (<strong>“</strong>). Line continuation &amp; soft-command-breaks are ignored inside quoted strings. An unterminated string literal (no closing quote) will cause an error.
</p>

<p>
Within a string, all characters represent their literal value except the colon (<strong>:</strong>), which is the escape character. Characters immediately following the colon also take on a special meaning.
</p>

<p>
<code>:)</code> represents a newline (\n)<br/>

<code>:&gt;</code> represents a tab (\t)<br/>

<code>:o</code> represents a bell (beep) (\g)<br/>

<code>:”</code> represents a literal double quote (<strong>“</strong>)<br/>

<code>::</code> represents a single literal colon (<strong>:</strong>)
</p>

<p>
The colon may also introduce more verbose escapes enclosed within some form of bracket.
</p>

<p>
<code>:(&lt;hex&gt;)</code> resolves the hex number into the corresponding Unicode code point.<br/>

<code>:{&lt;var&gt;}</code> interpolates the current value of the enclosed variable, cast as a string.<br/>

<code>:[&lt;char name&gt;]</code> resolves the &lt;char name&gt; in capital letters to the corresponding Unicode <a href="/web/20120908173209/http://www.unicode.org/Public/4.1.0/ucd/NamesList.txt" class="urlextern" title="http://www.unicode.org/Public/4.1.0/ucd/NamesList.txt"  rel="nofollow">normative name</a>.
</p>

</div>

<h3><a name="arrays" id="arrays">arrays</a></h3>
<div class="level3">

<p>
<em>Array and dictionary types are currently under-specified. There is general will to unify them, but indexing and definition is still under discussion.</em>
</p>

</div>

<h3><a name="types1" id="types1">types</a></h3>
<div class="level3">

<p>
<del>The TYPE type only has the values of TROOF, NOOB, NUMBR, NUMBAR, YARN, and TYPE, as bare words. They may be legally cast to TROOF (all true except for NOOB) or YARN.</del>
</p>

<p>
<em>TYPEs are under current review. Current sentiment is to delay defining them until user-defined types are relevant, but that would mean that type comparisons are left unresolved in the meantime.</em>
</p>

</div>

<h2><a name="operators" id="operators">Operators</a></h2>
<div class="level2">

</div>

<h3><a name="calling-syntax-and-precedence" id="calling-syntax-and-precedence">calling syntax and precedence</a></h3>
<div class="level3">

<p>
Mathematical operators and functions in general rely on prefix notation. By doing this, it is possible to call and compose operations with a minimum of explicit grouping. When all operators and functions have known arity, no grouping markers are necessary. In cases where operators have variable arity, the operation is closed with <code>MKAY</code>. An <code>MKAY</code> may be omitted if it coincides with the end of the line/statement, in which case the <acronym title="End of line">EOL</acronym> stands in for as many <code>MKAY</code>s as there are open variadic functions.
</p>

<p>
Calling unary operators then has the following syntax:

</p>
<pre class="code">&lt;operator&gt; &lt;expression1&gt;</pre>

<p>

The <code>AN</code> keyword can optionally be used to separate arguments, so a binary operator expression has the following syntax:

</p>
<pre class="code">&lt;operator&gt; &lt;expression1&gt; [AN] &lt;expression2&gt;</pre>

<p>

An expression containing an operator with infinite arity can then be expressed with the following syntax:

</p>
<pre class="code">&lt;operator&gt; &lt;expr1&gt; [[[AN] &lt;expr2&gt;] [AN] &lt;expr3&gt; …] MKAY</pre>

</div>

<h3><a name="math" id="math">math</a></h3>
<div class="level3">

<p>
The basic math operators are binary prefix operators.

</p>
<pre class="code">SUM OF &lt;x&gt; AN &lt;y&gt;       BTW  +
DIFF OF &lt;x&gt; AN &lt;y&gt;      BTW  -
PRODUKT OF &lt;x&gt; AN &lt;y&gt;   BTW  *
QUOSHUNT OF &lt;x&gt; AN &lt;y&gt;  BTW  /
MOD OF &lt;x&gt; AN &lt;y&gt;       BTW  modulo
BIGGR OF &lt;x&gt; AN &lt;y&gt;     BTW  max
SMALLR OF &lt;x&gt; AN &lt;y&gt;    BTW  min</pre>

<p>

<code>&lt;x&gt;</code> and <code>&lt;y&gt;</code> may each be expressions in the above, so mathematical operators can be nested and grouped indefinitely.
</p>

<p>
Math is performed as integer math in the presence of two NUMBRs, but if either of the expressions are NUMBARs, then floating point math takes over. 
</p>

<p>
If one or both arguments are a YARN, they get interpreted as NUMBARs if the YARN has a decimal point, and NUMBRs otherwise, then execution proceeds as above.
</p>

<p>
If one or another of the arguments cannot be safely cast to a numerical type, then it fails with an error.
</p>

</div>

<h3><a name="boolean" id="boolean">boolean</a></h3>
<div class="level3">

<p>
Boolean operators working on TROOFs are as follows:

</p>
<pre class="code">BOTH OF &lt;x&gt; [AN] &lt;y&gt;        BTW  and: WIN iff x=WIN, y=WIN
EITHER OF &lt;x&gt; [AN] &lt;y&gt;      BTW  or: FAIL iff x=FAIL, y=FAIL
WON OF &lt;x&gt; [AN] &lt;y&gt;         BTW  xor: FAIL if x=y
NOT &lt;x&gt;                     BTW unary negation: WIN if x=FAIL
ALL OF &lt;x&gt; [AN] &lt;y&gt; … MKAY  BTW infinite arity AND
ANY OF &lt;x&gt; [AN] &lt;y&gt; … MKAY  BTW infinite arity OR</pre>

<p>

&lt;x&gt; and &lt;y&gt; in the expression syntaxes above are automatically cast as TROOF values if they are not already so.
</p>

</div>

<h3><a name="comparison" id="comparison">comparison</a></h3>
<div class="level3">

<p>
Comparison is (currently) done with two binary equality operators:

</p>
<pre class="code">BOTH SAEM &lt;x&gt; [AN] &lt;y&gt;   BTW  WIN iff x == y
DIFFRINT &lt;x&gt; [AN] &lt;y&gt;    BTW  WIN iff x != y</pre>

<p>
Comparisons are performed as integer math in the presence of two NUMBRs, but if either of the expressions are NUMBARs, then floating point math takes over. Otherwise, there is <em>no</em> automatic casting in the equality, so <code>BOTH SAEM “3” AN 3</code> is <code>FAIL</code>.
</p>

<p>
There are (currently) no special numerical comparison operators. Greater-than and similar comparisons are done idiomatically using the minimum and maximum operators. 

</p>
<pre class="code">BOTH SAEM &lt;x&gt; AN BIGGR OF &lt;x&gt; AN &lt;y&gt;   BTW x &gt;= y
BOTH SAEM &lt;x&gt; AN SMALLR OF &lt;x&gt; AN &lt;y&gt;  BTW x &lt;= y
DIFFRINT &lt;x&gt; AN SMALLR OF &lt;x&gt; AN &lt;y&gt;   BTW x &gt; y
DIFFRINT &lt;x&gt; AN BIGGR OF &lt;x&gt; AN &lt;y&gt;    BTW x &lt; y</pre>

<p>

If <code>&lt;x&gt;</code> in the above formulations is too verbose or difficult to compute, don&#039;t forget the automatically created <code>IT</code> temporary variable. A further idiom could then be:

</p>
<pre class="code">&lt;expression&gt;, DIFFRINT IT AN SMALLR OF IT AN &lt;y&gt;</pre>

<p>

<em>Suggestions are being accepted for coherently and convincingly english-like prefix operator names for greater-than and similar operators.</em>
</p>

</div>

<h3><a name="concatenation" id="concatenation">concatenation</a></h3>
<div class="level3">

<p>
An indefinite number of YARNs may be explicitly concatenated with the <code>SMOOSH … MKAY</code> operator. Arguments may optionally be separated with <code>AN</code>. As the SMOOSH expects strings as its input arguments, it will implicitly cast all input values of other types to YARNs. The line ending may safely implicitly close the SMOOSH operator without needing an MKAY.
</p>

</div>

<h3><a name="casting" id="casting">casting</a></h3>
<div class="level3">

<p>

Operators that work on specific types implicitly cast parameter values of other types. If the value cannot be safely cast, then it results in an error.
</p>

<p>
An expression&#039;s value may be explicitly cast with the binary MAEK operator. 

</p>
<pre class="code">MAEK &lt;expression&gt; [A] &lt;type&gt;</pre>

<p>

Where <code>&lt;type&gt;</code> is one of TROOF, YARN, NUMBR, NUMBAR, or NOOB. This is only for local casting: only the resultant value is cast, not the underlying variable(s), if any.
</p>

<p>
To explicitly re-cast a variable, you may create a normal assignment statement with the MAEK operator, or use a casting assignment statement as follows:

</p>
<pre class="code">&lt;variable&gt; IS NOW A &lt;type&gt;         BTW equivalent to
&lt;variable&gt; R MAEK &lt;variable&gt; [A] &lt;type&gt;</pre>

</div>

<h2><a name="inputouput" id="inputouput">Input/Ouput</a></h2>
<div class="level2">

</div>

<h3><a name="terminal-based" id="terminal-based">terminal-based</a></h3>
<div class="level3">

<p>
The print (to STDOUT or the terminal) operator is <code>VISIBLE</code>. It has infinite arity and implicitly concatenates all of its arguments after casting them to <code>YARN</code>s. It is terminated by the statement delimiter (line end or comma). The output is automatically terminated with a carriage return (<code>:)</code>), unless the final token is terminated with an exclamation point (<code>!</code>), in which case the carriage return is suppressed.
</p>
<pre class="code">VISIBLE &lt;expression&gt; [&lt;expression&gt; …][!]</pre>

<p>
There is currently no defined standard for printing to a file.
</p>

<p>
To accept input from the user, the keyword is 
</p>
<pre class="code">GIMMEH &lt;variable&gt;</pre>

<p>
 which takes YARN for input and stores the value in the given variable.
</p>

<p>
<em>GIMMEH is defined minimally here as a holdover from <a href="/web/20120908173209/http://lolcode.com/specs/1.0" class="wikilink1" title="specs:1.0">1.0</a> and because there has not been any detailed discussion of this feature. We count on the liberal casting capabilities of the language and programmer inventiveness to handle input restriction.
<strong>GIMMEH may change in a future version</strong>.</em>
</p>

</div>

<h2><a name="statements" id="statements">Statements</a></h2>
<div class="level2">

</div>

<h3><a name="expression-statements" id="expression-statements">expression statements</a></h3>
<div class="level3">

<p>

A bare expression (e.g. a function call or math operation), without any assignment, is a legal statement in LOLCODE. Aside from any side-effects from the expression when evaluated, the final value is placed in the temporary variable <code>IT</code>. <code>IT</code>&#039;s value remains in local scope and exists until the next time it is replaced with a bare expression.
</p>

</div>

<h3><a name="assignment-statements" id="assignment-statements">assignment statements</a></h3>
<div class="level3">

<p>

Assignment statements have no side effects with <code>IT</code>. They are generally of the form:

</p>
<pre class="code">&lt;variable&gt; &lt;assignment operator&gt; &lt;expression&gt;</pre>

<p>

The variable being assigned may be used in the expression.

</p>

</div>

<h3><a name="flow-control-statements" id="flow-control-statements">flow control statements</a></h3>
<div class="level3">

<p>
Flow control statements cover multiple lines and are described in the following section.
</p>

</div>

<h2><a name="flow-control" id="flow-control">Flow control</a></h2>
<div class="level2">

</div>

<h3><a name="conditionals" id="conditionals">conditionals</a></h3>
<div class="level3">

</div>

<h4><a name="if-then" id="if-then">if-then</a></h4>
<div class="level4">

<p>
The traditional if/then construct is a very simple construct operating on the implicit <code>IT</code> variable. In the base form, there are four keywords: <code>O RLY?</code>, <code>YA RLY</code>, <code>NO WAI</code>, and <code>OIC</code>. 
</p>

<p>
<code>O RLY?</code> branches to the block begun with <code>YA RLY</code> if <code>IT</code> can be cast to <code>WIN</code>, and branches to the <code>NO WAI</code> block if <code>IT</code> is <code>FAIL</code>. The code block introduced with <code>YA RLY</code> is implicitly closed when <code>NO WAI</code> is reached. The <code>NO WAI</code> block is closed with <code>OIC</code>. The general form is then as follows:

</p>
<pre class="code">&lt;expression&gt;
O RLY?
  YA RLY
    &lt;code block&gt;
  NO WAI
    &lt;code block&gt;
OIC</pre>

<p>

while an example showing the ability to put multiple statements on a line separated by a comma would be:

</p>
<pre class="code">BOTH SAEM ANIMAL AN &quot;CAT&quot;, O RLY?
  YA RLY, VISIBLE &quot;J00 HAV A CAT&quot;
  NO WAI, VISIBLE &quot;J00 SUX&quot;
OIC</pre>

<p>
The elseif construction adds a little bit of complexity. Optional <code>MEBBE &lt;expression&gt;</code> blocks may appear between the <code>YA RLY</code> and <code>NO WAI</code> blocks. If the &lt;expression&gt; following <code>MEBBE</code> is true, then that block is performed; if not, the block is skipped until the following <code>MEBBE</code>, <code>NO WAI</code>, or <code>OIC</code>. The full expression syntax is then as follows:

</p>
<pre class="code">&lt;expression&gt;
O RLY?
  YA RLY
    &lt;code block&gt;
 [MEBBE &lt;expression&gt;
    &lt;code block&gt;
 [MEBBE &lt;expression&gt;
    &lt;code block&gt;
  …]]
 [NO WAI
    &lt;code block&gt;]
OIC</pre>

<p>

An example of this conditional is then:

</p>
<pre class="code">BOTH SAEM ANIMAL AN &quot;CAT&quot;
O RLY?
  YA RLY, VISIBLE &quot;J00 HAV A CAT&quot;
  MEBBE BOTH SAEM ANIMAL AN &quot;MAUS&quot;
    VISIBLE &quot;NOM NOM NOM. I EATED IT.&quot;
OIC</pre>

</div>

<h4><a name="case" id="case">case</a></h4>
<div class="level4">

<p>
<em>Modified from <a href="/web/20120908173209/http://lolcode.com/specs/1.1" class="wikilink1" title="specs:1.1">1.1</a></em>
</p>

<p>
The LOLCODE keyword for switches is <code><acronym title="What the f***">WTF?</acronym></code>. The <code><acronym title="What the f***">WTF?</acronym></code> operates on <code>IT</code> as being the expression value for comparison. A comparison block is opened by <code><acronym title="Oh my God">OMG</acronym></code> and must be a literal, not an expression. (A literal, in this case, <em>excludes</em> any YARN containing variable interpolation (<code>:{var}</code>). ) Each literal must be unique. The <code><acronym title="Oh my God">OMG</acronym></code> block can be followed by any number of statements and may be terminated by a <code>GTFO</code>, which breaks to the end of the the WTF statement. If an <code><acronym title="Oh my God">OMG</acronym></code> block is not terminated by a <code>GTFO</code>, then the next <code><acronym title="Oh my God">OMG</acronym></code> block is executed as is the next until a <code>GTFO</code> or the end of the <code>WTF</code> block is reached. The optional default case, if none of the literals evaluate as true, is signified by 
<code>OMGWTF</code>.

</p>
<pre class="code">&lt;expression&gt;
WTF?
  OMG &lt;value literal&gt;
    &lt;code block&gt;
 [OMG &lt;value literal&gt;
    &lt;code block&gt; …]
 [OMGWTF
    &lt;code block&gt;]
OIC</pre>
<pre class="code">COLOR, WTF?
  OMG &quot;R&quot;
    VISIBLE &quot;RED FISH&quot;
    GTFO
  OMG &quot;Y&quot;
    VISIBLE &quot;YELLOW FISH&quot;
  OMG &quot;G&quot;
  OMG &quot;B&quot;
    VISIBLE &quot;FISH HAS A FLAVOR&quot;
    GTFO
  OMGWTF
    VISIBLE &quot;FISH IS TRANSPARENT&quot;
OIC</pre>

<p>
In this example, the output results of evaluating the variable COLOR would be:<br/>

“R” : 
</p>
<pre class="file">RED FISH</pre>

<p>

“Y” : 
</p>
<pre class="file">YELLOW FISH
FISH HAS A FLAVOR</pre>

<p>

“G” : 
</p>
<pre class="file">FISH HAS A FLAVOR</pre>

<p>

“B” : 
</p>
<pre class="file">FISH HAS A FLAVOR</pre>

<p>

none of the above: 
</p>
<pre class="file">FISH IS TRANSPARENT</pre>

</div>

<h3><a name="loops" id="loops">loops</a></h3>
<div class="level3">

<p>
<em>Loops are currently defined more or less as they were in the original examples. Further looping constructs will be added to the language soon.</em>
</p>

<p>
Simple loops are demarcated with <code>IM IN YR &lt;label&gt;</code> and <code>IM OUTTA YR &lt;label&gt;</code>. Loops defined this way are infinite loops that must be explicitly exited with a <code>GTFO</code> break. Currently, the &lt;label&gt; is required, but is unused, except for marking the start and end of the loop.
</p>

<p>
<em>Immature <acronym title="specification">spec</acronym> — <strong>subject to change</strong>: </em>
</p>

<p>
Iteration loops have the form:

</p>
<pre class="code">IM IN YR &lt;label&gt; &lt;operation&gt; YR &lt;variable&gt; [TIL|WILE &lt;expression&gt;]
  &lt;code block&gt;
IM OUTTA YR &lt;label&gt;</pre>

<p>

Where <code>&lt;operation&gt;</code> may be <code>UPPIN</code> (increment by one), <code>NERFIN</code> (decrement by one), or any unary function. That operation/function is applied to the <code>&lt;variable&gt;</code>, which is temporary, and local to the loop. The <code>TIL &lt;expression&gt;</code> evaluates the expression as a TROOF: if it evaluates as <code>FAIL</code>, the loop continues once more, if not, then loop execution stops, and continues after the matching <code>IM OUTTA YR &lt;label&gt;</code>. The <code>WILE &lt;expression&gt;</code> is the converse: if the expression is <code>WIN</code>, execution continues, otherwise the loop exits.
</p>

</div>

<h2><a name="functions" id="functions">Functions</a></h2>
<div class="level2">

</div>

<h3><a name="definition" id="definition">definition</a></h3>
<div class="level3">

<p>

A function is demarked with the opening keyword <code>HOW DUZ I</code> and the closing keyword <code>IF U SAY SO</code>. The syntax is as follows:

</p>
<pre class="code">HOW DUZ I &lt;function name&gt; [YR &lt;argument1&gt; [AN YR &lt;argument2&gt; …]]
  &lt;code block&gt;
IF U SAY SO</pre>

<p>

Currently, the number of arguments in a function can only be defined as a fixed number. The &lt;argument&gt;s are single-word identifiers that act as variables within the scope of the function&#039;s code. The calling parameters&#039; values are then the initial values for the variables within the function&#039;s code block when the function is called.
</p>

<p>
<em>Currently, functions do not have access to the outer/calling code block&#039;s variables.</em>
</p>

</div>

<h3><a name="returning" id="returning">returning</a></h3>
<div class="level3">

<p>
Return from the function is accomplished in one of the following ways:
</p>
<ol>
<li class="level1"><div class="li"> <code>FOUND YR &lt;expression&gt;</code> returns the value of the expression.</div>
</li>
<li class="level1"><div class="li"> <code>GTFO</code> returns with no value (NOOB).</div>
</li>
<li class="level1"><div class="li"> in the absence of any explicit break, when the end of the code block is reached (<code>IF U SAY SO</code>), the value in <code>IT</code> is returned.</div>
</li>
</ol>

</div>

<h3><a name="calling" id="calling">calling</a></h3>
<div class="level3">

<p>
A function of given arity is called with:

</p>
<pre class="code">&lt;function name&gt; [&lt;expression1&gt; [&lt;expression2&gt; [&lt;expression3&gt; …]]]</pre>

<p>

That is, an expression is formed by the function name followed by any arguments. Those arguments may themselves be expressions. The expressions&#039; values are obtained before the function is called. The arity of the functions is determined in the definition. 

</p>

</div>

      <!-- wikipage stop -->
      
            <div class="meta">
        specs/1.2.txt &middot; Last modified: 2007/07/24 00:21 by kieferskunk      </div>
            
        
          </div><!-- page -->
    
    <div class="sidebar">
      
<p>
<strong><a href="/web/20120908173209/http://lolcode.com/home" class="wikilink1" title="home">Home</a></strong><br/>

<strong><a href="/web/20120908173209/http://forum.lolcode.com/" class="urlextern" title="http://forum.lolcode.com/"  rel="nofollow">Forum</a></strong><br/>

<strong><a href="/web/20120908173209/http://store.lolcode.com/" class="urlextern" title="http://store.lolcode.com/"  rel="nofollow">Store</a></strong><br/>

<strong><a href="/web/20120908173209/http://www.facebook.com/pages/LOLCODE/21440776600" class="urlextern" title="http://www.facebook.com/pages/LOLCODE/21440776600"  rel="nofollow">Facebook</a></strong><br/>

<strong><a href="/web/20120908173209/http://www.flickr.com/groups/lolcode/" class="urlextern" title="http://www.flickr.com/groups/lolcode/"  rel="nofollow">Flickr</a></strong><br/>

<strong><a href="/web/20120908173209/http://lindsay.at/blog/" class="urlextern" title="http://lindsay.at/blog/"  rel="nofollow">Adam&#039;s blog</a></strong><br/>

<strong><a class="feed" href="/web/20120908173209/http://feeds.lolcode.com/lolcode">News</a></strong><br/>

<strong><script type="text/javascript" src="/web/20120908173209js_/http://w.sharethis.com/widget/?tabs=web%2Cpost%2Cemail&charset=utf-8&style=default&publisher=913cc65b-8500-42d1-a282-83e3ec0e665b&headerbg=%23e5d9ff&linkfg=%23003f9e"></script></strong>

</p>

<div>

<ul class="idx">
<li class="closed"><div class="li"><a href="/web/20120908173209/http://lolcode.com/articles?idx=articles" class="indexmenu_idx">articles</a></div></li>
<li class="closed"><div class="li"><a href="/web/20120908173209/http://lolcode.com/contributions/contributions" class="indexmenu_idx_head">contributions</a></div></li>
<li class="closed"><div class="li"><a href="/web/20120908173209/http://lolcode.com/examples/examples" class="indexmenu_idx_head">examples</a></div></li>
<li class="closed"><div class="li"><a href="/web/20120908173209/http://lolcode.com/implementations/implementations" class="indexmenu_idx_head">implementations</a></div></li>
<li class="closed"><div class="li"><a href="/web/20120908173209/http://lolcode.com/keywords/keywords" class="indexmenu_idx_head">keywords</a></div></li>
<li class="closed"><div class="li"><a href="/web/20120908173209/http://lolcode.com/playground/playground" class="indexmenu_idx_head">playground</a></div></li>
<li class="closed"><div class="li"><a href="/web/20120908173209/http://lolcode.com/proposals/proposals" class="indexmenu_idx_head">proposals</a></div></li>
<li class="closed"><div class="li"><a href="/web/20120908173209/http://lolcode.com/specs?idx=specs" class="indexmenu_idx">specs</a></div></li>
<li class="closed"><div class="li"><a href="/web/20120908173209/http://lolcode.com/tests/tests" class="indexmenu_idx_head">tests</a></div></li>
<li class="closed"><div class="li"><a href="/web/20120908173209/http://lolcode.com/wiki?idx=wiki" class="indexmenu_idx">wiki</a></div></li>
<li class="level1"><div class="li"><a href="/web/20120908173209/http://lolcode.com/about" class="wikilink1" title="about">about</a></div></li>
<li class="level1"><div class="li"><a href="/web/20120908173209/http://lolcode.com/contribute" class="wikilink1" title="contribute">contribute</a></div></li>
<li class="level1"><div class="li"><a href="/web/20120908173209/http://lolcode.com/faq" class="wikilink1" title="faq">faq</a></div></li>
<li class="level1"><div class="li"><a href="/web/20120908173209/http://lolcode.com/links" class="wikilink1" title="links">links</a></div></li></ul>
</div>

<p>

<script language="javascript" src="/web/20120908173209js_/http://cache.blogads.com/176020183/feed.js"></script><a href=/web/20120908173209/http://www.blogads.com/>blog advertising</a> is good for you.
</p>

<p>
<strong>Links</strong><br/>

<a href="/web/20120908173209/http://lol.ianloic.com/feed/feeds.lolcode.com/lolcode" class="urlextern" title="http://lol.ianloic.com/feed/feeds.lolcode.com/lolcode"  rel="nofollow">Site news via cat macros</a><br/>

<a href="/web/20120908173209/http://www.icanhascheezburger.com/" class="urlextern" title="http://www.icanhascheezburger.com/"  rel="nofollow">ICHC</a><br/>

<a href="/web/20120908173209/http://lolbots.com/" class="urlextern" title="http://lolbots.com/"  rel="nofollow">LOL BOTS</a><br/>

<a href="/web/20120908173209/http://loltheist.com/" class="urlextern" title="http://loltheist.com/"  rel="nofollow">LOLTheist</a><br/>

Powered by <a href="/web/20120908173209/http://joyent.com/connector/web-hosting/" class="urlextern" title="http://joyent.com/connector/web-hosting/"  rel="nofollow">Joyent</a>
</p>
      <hr />
              <ul>
          <li><div class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2?do=index"  class="action index" accesskey="x" rel="nofollow">Index</a></div></li>
          <li><div class="li"><a href="/web/20120908173209/http://lolcode.com/?do=recent"  class="action recent" accesskey="r" rel="nofollow">Recent changes</a></div></li>
        </ul>
            <div class="centeralign"><form action="/web/20120908173209/http://lolcode.com/" accept-charset="utf-8" class="search" id="dw__search"><div class="no"><input type="hidden" name="do" value="search" /><input type="text" id="qsearch__in" accesskey="f" name="id" class="edit" title="[ALT+F]" /><input type="submit" value="Search" class="button" title="Search" /><div id="qsearch__out" class="ajax_qsearch JSpopup"></div></div></form></div>
              <hr />
        <ul>
          <li><div class="li"><a href="/web/20120908173209/http://lolcode.com/specs/1.2?do=login&sectok=4ba97abbfe5a6b44f9ebc45762856a56"  class="action login" rel="nofollow">Login</a>                    </div></li>
                  </ul>
       
    	<!-- Begin Project Wonderful ad code: -->
	<!-- IMPORTANT: All lines, including these comments, must be included. -->
	<!-- Removing or altering them could result in your ads being automatically shut down! -->
	<!-- Ad box ID: 3205 -->
	<script language='JavaScript' type='text/javascript'>
	// <![CDATA[
	r = new String (Math.random()*1000);
	r = r.substr(0, 5);
	s = new String ("<script language='JavaScript' type='text/javascript'");
	s += "src = /web/20120908173209/http://www.projectwonderful.com/gen.php";
	s += "?id=3205&amp;type=4";
	s += "&amp;r=" + r;
	if (document.referrer){
	s += "&amp;referer=" + escape(document.referrer);
	}
	s += "><\/scr";
	s += "ipt>";
	document.write(s);
	// ]]>
	</script>
	<noscript><map name="admap3205" id="admap3205"><area href="/web/20120908173209/http://www.projectwonderful.com/out_nojs.php?r=0&c=0&id=3205&type=4" shape="rect" coords="0,0,125,125" title="" alt="" target="_blank" /><area href="/web/20120908173209/http://www.projectwonderful.com/out_nojs.php?r=1&c=0&id=3205&type=4" shape="rect" coords="0,125,125,250" title="" alt="" target="_blank" /></map>
	<table cellpadding="0" border="0" cellspacing="0" width="125" bgcolor=""><tr><td><img src="/web/20120908173209im_/http://www.projectwonderful.com/nojs.php?id=3205&type=4" width="125" height="250" usemap="#admap3205" border="0" alt="" /></td></tr><tr><td bgcolor="" colspan="1"><center><a style="font-size:10px;color:#32009E;text-decoration:none;line-height:1.2;font-weight:bold;font-family:Tahoma, verdana,arial,helvetica,sans-serif;" href="/web/20120908173209/http://www.projectwonderful.com/advertisehere.php?id=3205&type=4" target="_blank">Project Wonderful - Your ad here, right now, for as low as $0.00</a></center></td></tr></table>
	</noscript>
	<!-- End Project Wonderful ad code. -->
            </div><!-- sidebar -->
  
  </div><!-- main -->

  <div class="clearer"></div>

    
  <div class="footer">
    <div class="edgeleft"><div class="borderbottom">&nbsp;</div></div>
    <div class="edgeright"><div class="borderbottom">&nbsp;</div></div>
  </div><!-- footer -->

</div>
<script type="text/javascript">
lloogg_clientid = "20300209cbe8e695";
</script>
<script type="text/javascript" src="/web/20120908173209js_/http://lloogg.com/l.js?c=20300209cbe8e695">
</script>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "/web/20120908173209/https://ssl." : "/web/20120908173209/http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-595621-4");
pageTracker._initData();
pageTracker._trackPageview();
</script>

<div class="footerinc">
  <a  href="/web/20120908173209/http://lolcode.com/feed.php" title="Recent changes RSS feed"><img src="/web/20120908173209im_/http://lolcode.com/lib/tpl/minima/images/button-rss.png" width="80" height="15" alt="Recent changes RSS feed" /></a>

  <a  href="/web/20120908173209/http://creativecommons.org/licenses/by-nc-sa/2.0/" rel="license" title="Creative Commons License"><img src="/web/20120908173209im_/http://lolcode.com/lib/tpl/minima/images/button-cc.gif" width="80" height="15" alt="Creative Commons License" /></a>

  <a  href="/web/20120908173209/https://www.paypal.com/xclick/business=andi%40splitbrain.org&item_name=DokuWiki+Donation&no_shipping=1&no_note=1&tax=0&currency_code=EUR&lc=US" title="Donate"><img src="/web/20120908173209im_/http://lolcode.com/lib/tpl/minima/images/button-donate.gif" alt="Donate" width="80" height="15" /></a>

  <a  href="/web/20120908173209/http://wiki.splitbrain.org/wiki:dokuwiki" title="Driven by DokuWiki"><img src="/web/20120908173209im_/http://lolcode.com/lib/tpl/minima/images/button-dw.png" width="80" height="15" alt="Driven by DokuWiki" /></a>


<!--

<rdf:RDF xmlns="/web/20120908173209/http://web.resource.org/cc/"
    xmlns:dc="/web/20120908173209/http://purl.org/dc/elements/1.1/"
    xmlns:rdf="/web/20120908173209/http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<Work rdf:about="">
   <dc:type rdf:resource="/web/20120908173209/http://purl.org/dc/dcmitype/Text" />
   <license rdf:resource="/web/20120908173209/http://creativecommons.org/licenses/by-nc-sa/2.0/" />
</Work>

<License rdf:about="/web/20120908173209/http://creativecommons.org/licenses/by-nc-sa/2.0/">
   <permits rdf:resource="/web/20120908173209/http://web.resource.org/cc/Reproduction" />
   <permits rdf:resource="/web/20120908173209/http://web.resource.org/cc/Distribution" />
   <requires rdf:resource="/web/20120908173209/http://web.resource.org/cc/Notice" />
   <requires rdf:resource="/web/20120908173209/http://web.resource.org/cc/Attribution" />
   <prohibits rdf:resource="/web/20120908173209/http://web.resource.org/cc/CommercialUse" />
   <permits rdf:resource="/web/20120908173209/http://web.resource.org/cc/DerivativeWorks" />
   <requires rdf:resource="/web/20120908173209/http://web.resource.org/cc/ShareAlike" />
</License>

</rdf:RDF>

-->


</div>

<div class="no"><img src="/web/20120908173209im_/http://lolcode.com/lib/exe/indexer.php?id=specs%3A1.2&1347125529" width="1" height="1" alt=""  /></div>
</body>
</html>





<!--
     FILE ARCHIVED ON 17:32:09 сен 8, 2012 AND RETRIEVED FROM THE
     INTERNET ARCHIVE ON 20:02:46 июн 29, 2013.
     JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE.

     ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C.
     SECTION 108(a)(3)).
-->
